package com.briup.recognition.service.impl;

import com.briup.recognition.bean.Dataset;
import com.briup.recognition.bean.DatasetExample;
import com.briup.recognition.dao.DatasetMapper;
import com.briup.recognition.service.IDatasetService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DatasetServiceImpl implements IDatasetService {


    @Resource
    private DatasetMapper datasetMapper;

    @Override
    public List<Dataset> query() {
        DatasetExample example=new DatasetExample();

        return datasetMapper.selectByExample(example);

    }

    @Override
    public void saveOrUpdate(Dataset dataset) {
        if (dataset.getId()!=null){
            datasetMapper.updateByPrimaryKey(dataset);
        }else {
            datasetMapper.insert(dataset);
        }

    }

    @Override
    public void deleteById(long id) {
        datasetMapper.deleteByPrimaryKey(id);

    }
}
